<script setup lang="ts">
import { ref } from 'vue';

const value1 = ref('');
const value2 = ref('');
const formatter = (value: string) => value.replace(/\d/g, '');
</script>

<template>
  <demo-block title="格式化输入内容">
    <vcu-cell-group inset>
      <vcu-input
        v-model="value1"
        label="文本"
        :formatter="formatter"
        placeholder="在输入时执行格式化"
      />
      <vcu-input
        v-model="value2"
        label="文本"
        :formatter="formatter"
        format-trigger="onBlur"
        placeholder="在失焦时执行格式化"
      />
    </vcu-cell-group>
  </demo-block>
</template>
